package cn.iocoder.yudao.module.handguard.controller.app.userbasetable7;

import cn.iocoder.yudao.module.handguard.controller.app.userbasetable14.vo.UserBaseTable14RespVO;
import cn.iocoder.yudao.module.handguard.convert.userbasetable14.UserBaseTable14Convert;
import cn.iocoder.yudao.module.handguard.dal.dataobject.userbasetable14.UserBaseTable14DO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;

import cn.iocoder.yudao.module.handguard.controller.app.userbasetable7.vo.*;
import cn.iocoder.yudao.module.handguard.dal.dataobject.userbasetable7.UserBaseTable7DO;
import cn.iocoder.yudao.module.handguard.convert.userbasetable7.UserBaseTable7Convert;
import cn.iocoder.yudao.module.handguard.service.userbasetable7.UserBaseTable7Service;

@Tag(name = "小程序 - 全款车按揭车信贷")
@RestController
@RequestMapping("/hutai/user-base-table7")
@Validated
public class UserBaseTable7Controller {

    @Resource
    private UserBaseTable7Service userBaseTable7Service;

    @PostMapping("/create")
    @Operation(summary = "创建全款车按揭车信贷")
    public CommonResult<Long> createUserBaseTable7(@Valid @RequestBody UserBaseTable7CreateReqVO createReqVO) {
        return success(userBaseTable7Service.createUserBaseTable7(createReqVO));
    }

    @PutMapping("/update")
    @Operation(summary = "更新全款车按揭车信贷")
    public CommonResult<Boolean> updateUserBaseTable7(@Valid @RequestBody UserBaseTable7UpdateReqVO updateReqVO) {
        userBaseTable7Service.updateUserBaseTable7(updateReqVO);
        return success(true);
    }

    @GetMapping("/get")
    @Operation(summary = "获得全款车按揭车信贷")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    public CommonResult<UserBaseTable7RespVO> getUserBaseTable7(@RequestParam("id") Long id) {
        UserBaseTable7DO userBaseTable7 = userBaseTable7Service.getUserBaseTable7(id);
        return success(UserBaseTable7Convert.INSTANCE.convert(userBaseTable7));
    }


    @GetMapping("/list")
    @Operation(summary = "获得全款车按揭车列表")
    public CommonResult<List<UserBaseTable7RespVO>> getUserBaseTable7List(Long ui) {
        List<UserBaseTable7DO> list = userBaseTable7Service.getUserBaseTable7List(ui);
        return success(UserBaseTable7Convert.INSTANCE.convertList(list));
    }


}
